<?php
/**
 * @file VchangePassword.php
 * @author LD <2009-10-30 10:02:58>
 * @package kbao
 * @desc
 *   修改安全密码视图文件
 */
if(!defined('ACCOUNT_INIT'))
	exit('Access Denied!');

/* 定义全局变量 */
global $gLD;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
	<?php if ($gLD['pswd_type'] == '*NEWSET') echo "设置账户安全密码";
		  else echo "修改账户安全密码";
     ?>
</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<style type="text/css">
<!--
.blue1 { color: #8dc3f2; font-size: 12px;font-weight: bold;}
body {background-color: #8ec2f4;margin:0;}
body,td,th {font-size: 12px;color: #FFFFFF;}
.STYLE2 {color: #8dc3f2; font-size: 14px; font-weight: bold; }
.STYLE3 {color: #FF0000}
-->
</style>
<script language="javascript" type="text/javascript">
	// 验证4个密码
	function valiChgPswd(){
		var kmpswd = document.myform.kmpswd.value;
		var oldpswd = document.myform.oldpswd.value;
		var pswd = document.myform.pswd.value;
		var pswd2 = document.myform.pswd2.value;

		if( pswd.length != 8  ){
			alert("新安全密码必须为8位英文或数字字符！");
			return false;
		}else if(kmpswd == ''){
			alert("登录密码不能为空！");
			return false;
		}else if( oldpswd != '*NEWSET'){
			if( oldpswd.length != 8){
				alert("旧安全密码必须为8位英文或数字字符！");
				return false;
			}
		}else if( pswd != pswd2 ){
			alert("两次输入的新密码不相符！");
			return false;
		}
		
		return true;
	}
</script>
</head>
<body>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr><td height="98">&nbsp;</td></tr>
</table>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
      	<tr bgcolor="#014075"><td height="32" align="center" width="85%"><span class="STYLE2">
      		<?php if ($gLD['pswd_type'] == '*NEWSET') echo "设置安全密码";
		  		  else echo "修改安全密码"; ?></span>
		  </td>
		  <td algin="right"><a href="javascript:history.go(-1);">&gt;&gt; 返回上一页</a></td>
      	</tr></table>
<table width="550" border="0" cellspacing="0" cellpadding="4">
  <tr>
    <td height="276" align="center" bgcolor="#3676B4">
    <table width="96%" border="0" cellspacing="0" cellpadding="0">
      <tr>
      <td height="30" bgcolor="#70A2D3"><span class="STYLE3">说明：请务必牢记您的安全密码，密码遗忘会导致您无法登录交易系统！</span></td>
      </tr>
    </table>
    <table width="90%" border="0" cellspacing="0" cellpadding="0">
        <tr><td height="25">&nbsp;</td></tr>
      </table>
<form name="myform" action="?black%20hole=<?php echo $gLD['BlackHole']; ?>&uin=<?php echo $gLD['user_id']; ?>&module=chgpswd" method="post" onsubmit="return valiChgPswd();">      
	<input type="hidden" name="action" value="chgpswd" />
  	<input type="hidden" name="user_id" value="<?php echo $gLD['user_id']; ?>" />
  
	<table width="85%" height="131" border="0" cellpadding="0" cellspacing="0">
      <tr>
    	<td align="right">ID：<?php echo $gLD['user_id']; ?> &nbsp;&nbsp;</td>
         <td align="left"> &nbsp;&nbsp;&nbsp;&nbsp;用户昵称：<?php echo $gLD['user_nick']; ?></td>
      </tr>
      <tr>
      	<td width="25%" align="right">登录密码：</td>
        <td width="75%" align="left"><input type="password" name="kmpswd" /></td>
      </tr>
      <?php if ($gLD['pswd_type'] == '*NEWSET'){ ?>
      <input type="hidden" name="oldpswd" value="<?php echo $gLD['pswd_type']; ?>" />
      <?php }else { ?>	
      <tr>
        <td align="right">原安全密码：</td>
        <td align="left"><input type="password" name="oldpswd" maxlength="8" onkeyup="value=value.replace(/[\W]/g,'')" 
           onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /></td>
      </tr>
      <?php } ?>
        <tr>
          <td align="right">新账户安全密码：</td>
          <td align="left"><input name="pswd" type="password" maxlength="8" onkeyup="value=value.replace(/[\W]/g,'')" 
           onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
         （必须为8位英文或数字字符）</td>
        </tr>
        <tr>
          <td align="right">重复新安全密码：</td>
          <td align="left"><input name="pswd2" type="password" maxlength="8" onkeyup="value=value.replace(/[\W]/g,'')" 
           onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /></td>
        </tr>
<?php if (!empty($gLD['msg'])){ ?>
<tr><td COLSPAN='2' align="center" id="error">Error: <?php echo $gLD['msg']; ?></td></tr>
<script type='text/javascript'>alert('<?php echo $gLD['msg']; ?>');</script>
<?php } ?>
      </table>
      <table width="39%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="60" align="center"><input type="submit" name="Submit" value=" 提交 " /></td>
          <td align="center"><input type="reset" name="Submit2" value=" 重置 " /></td>
        </tr>
      </table>
</form><!-- /设置密码 -->      
  </td></tr>
</table>

</td></tr></table>
</body>
</html>